Open Bug 1715358 Opened 4 years ago Updated 4 years ago

Large allocation after calling [@ mozilla::gfx::DrawTargetSkia::Stroke]

Categories

(Core :: Graphics: Canvas2D, defect)

defect

Tracking

()

Tracking Status
firefox91 --- affected

People

(Reporter: tsmith, Unassigned)

References

(Blocks 2 open bugs)

Details

(Keywords: csectype-oom, testcase)

Attachments

(1 file)

Attached file testcase.html

Found while fuzzing m-c 20210604-963df76dc655 (--enable-address-sanitizer --enable-fuzzing)

To help catch this issue ASAN_OPTIONS=max_allocation_size_mb=512 was used. See Bug 1715316 for details about fuzzing triggered OOMs.

==242706==WARNING: AddressSanitizer failed to allocate 0x23105000 bytes
=================================================================
==242706==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000001 (pc 0x55e53053ab48 bp 0x7ffdedaa7e10 sp 0x7ffdedaa7e00 T0)
==242706==The signal is caused by a WRITE memory access.
==242706==Hint: address points to the zero page.
    #0 0x55e53053ab48 in mozalloc_abort src/memory/mozalloc/mozalloc_abort.cpp:33:3
    #1 0x55e53053acdd in mozalloc_handle_oom(unsigned long) src/memory/mozalloc/mozalloc_oom.cpp:51:3
    #2 0x55e53053abfb in moz_xmalloc src/memory/mozalloc/mozalloc.cpp:54:5
    #3 0x7f1ecca178b1 in operator new[] /builds/worker/workspace/obj-build/dist/include/mozilla/cxxalloc.h:42:10
    #4 0x7f1ecca178b1 in SkArenaAlloc::ensureSpace(unsigned int, unsigned int) src/gfx/skia/skia/src/core/SkArenaAlloc.cpp:131:22
    #5 0x7f1ecc874d90 in SkArenaAlloc::allocObject(unsigned int, unsigned int) src/gfx/skia/skia/src/core/SkArenaAlloc.h:165:19
    #6 0x7f1ecccb2e93 in char* SkArenaAlloc::commonArrayAlloc<SkAnalyticEdge>(unsigned int) src/gfx/skia/skia/src/core/SkArenaAlloc.h:181:30
    #7 0x7f1eccc94f66 in SkAnalyticEdge* SkArenaAlloc::makeArrayDefault<SkAnalyticEdge>(unsigned long) src/gfx/skia/skia/src/core/SkArenaAlloc.h:105:30
    #8 0x7f1eccc9514f in SkEdgeBuilder::buildPoly(SkPath const&, SkIRect const*, bool) src/gfx/skia/skia/src/core/SkEdgeBuilder.cpp:235:24
    #9 0x7f1eccd7dc82 in aaa_fill_path src/gfx/skia/skia/src/core/SkScan_AAAPath.cpp:1855:38
    #10 0x7f1eccd7dc82 in SkScan::AAAFillPath(SkPath const&, SkBlitter*, SkIRect const&, SkIRect const&, bool) src/gfx/skia/skia/src/core/SkScan_AAAPath.cpp:2001:9
    #11 0x7f1ecc8ef374 in SkScan::AntiFillPath(SkPath const&, SkRegion const&, SkBlitter*, bool) src/gfx/skia/skia/src/core/SkScan_AntiPath.cpp:792:9
    #12 0x7f1ecc8efd53 in SkScan::AntiFillPath(SkPath const&, SkRasterClip const&, SkBlitter*) src/gfx/skia/skia/src/core/SkScan_AntiPath.cpp:829:9
    #13 0x7f1eccc7e160 in SkDraw::drawDevPath(SkPath const&, SkPaint const&, bool, SkBlitter*, bool) const src/gfx/skia/skia/src/core/SkDraw.cpp:881:5
    #14 0x7f1eccc7eafa in SkDraw::drawPath(SkPath const&, SkPaint const&, SkMatrix const*, bool, bool, SkBlitter*) const src/gfx/skia/skia/src/core/SkDraw.cpp:963:11
    #15 0x7f1ecca21d3b in drawPath src/gfx/skia/skia/src/core/SkDraw.h:56:15
    #16 0x7f1ecca21d3b in SkBitmapDevice::drawPath(SkPath const&, SkPaint const&, bool) src/gfx/skia/skia/src/core/SkBitmapDevice.cpp:401:15
    #17 0x7f1ecca4d57e in SkCanvas::onDrawPath(SkPath const&, SkPaint const&) src/gfx/skia/skia/src/core/SkCanvas.cpp:2365:23
    #18 0x7f1ecca468f5 in SkCanvas::drawPath(SkPath const&, SkPaint const&) src/gfx/skia/skia/src/core/SkCanvas.cpp:1878:11
    #19 0x7f1ec46e63ff in mozilla::gfx::DrawTargetSkia::Stroke(mozilla::gfx::Path const*, mozilla::gfx::Pattern const&, mozilla::gfx::StrokeOptions const&, mozilla::gfx::DrawOptions const&) src/gfx/2d/DrawTargetSkia.cpp:863:12
    #20 0x7f1ec74dee15 in mozilla::dom::CanvasRenderingContext2D::Stroke() src/dom/canvas/CanvasRenderingContext2D.cpp:2836:11
    #21 0x7f1ec666c398 in mozilla::dom::CanvasRenderingContext2D_Binding::stroke(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/CanvasRenderingContext2DBinding.cpp:3003:28
    #22 0x7f1ec73aa979 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) src/dom/bindings/BindingUtils.cpp:3298:13
    #23 0x7f1ece1b6182 in CallJSNative src/js/src/vm/Interpreter.cpp:426:13
    #24 0x7f1ece1b6182 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) src/js/src/vm/Interpreter.cpp:511:12
    #25 0x7f1ece19db5f in CallFromStack src/js/src/vm/Interpreter.cpp:575:10
    #26 0x7f1ece19db5f in Interpret(JSContext*, js::RunState&) src/js/src/vm/Interpreter.cpp:3226:16
    #27 0x7f1ece1876b6 in js::RunScript(JSContext*, js::RunState&) src/js/src/vm/Interpreter.cpp:395:13
    #28 0x7f1ece1b62bb in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) src/js/src/vm/Interpreter.cpp:543:13
    #29 0x7f1ece1b7ebb in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) src/js/src/vm/Interpreter.cpp:588:8
    #30 0x7f1ecea252a2 in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) src/js/src/jsapi.cpp:2777:10
    #31 0x7f1ec6eeaaf9 in mozilla::dom::EventListener::HandleEvent(mozilla::dom::BindingCallContext&, JS::Handle<JS::Value>, mozilla::dom::Event&, mozilla::ErrorResult&) /builds/worker/workspace/obj-build/dom/bindings/EventListenerBinding.cpp:58:8
    #32 0x7f1ec7b61088 in void mozilla::dom::EventListener::HandleEvent<mozilla::dom::EventTarget*>(mozilla::dom::EventTarget* const&, mozilla::dom::Event&, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JS::Realm*) /builds/worker/workspace/obj-build/dist/include/mozilla/dom/EventListenerBinding.h:65:12
    #33 0x7f1ec7b60b80 in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) src/dom/events/EventListenerManager.cpp:1108:43
    #34 0x7f1ec7b621a7 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) src/dom/events/EventListenerManager.cpp:1305:17
    #35 0x7f1ec7b4f52e in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) src/dom/events/EventDispatcher.cpp:355:17
    #36 0x7f1ec7b4dd51 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) src/dom/events/EventDispatcher.cpp:557:16
    #37 0x7f1ec7b52155 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) src/dom/events/EventDispatcher.cpp:1116:11
    #38 0x7f1ec7b57bd9 in mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) src/dom/events/EventDispatcher.cpp
    #39 0x7f1ec5aa139a in nsINode::DispatchEvent(mozilla::dom::Event&, mozilla::dom::CallerType, mozilla::ErrorResult&) src/dom/base/nsINode.cpp:1331:17
    #40 0x7f1ec55739af in nsContentUtils::DispatchEvent(mozilla::dom::Document*, nsISupports*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, mozilla::Trusted, bool*, mozilla::ChromeOnlyDispatch) src/dom/base/nsContentUtils.cpp:4316:28
    #41 0x7f1ec55736f3 in nsContentUtils::DispatchTrustedEvent(mozilla::dom::Document*, nsISupports*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, bool*) src/dom/base/nsContentUtils.cpp:4286:10
    #42 0x7f1ec57f4516 in mozilla::dom::Document::DispatchContentLoadedEvents() src/dom/base/Document.cpp:7687:3
    #43 0x7f1ec58b2a6f in applyImpl<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1150:12
    #44 0x7f1ec58b2a6f in apply<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1156:12
    #45 0x7f1ec58b2a6f in mozilla::detail::RunnableMethodImpl<mozilla::dom::Document*, void (mozilla::dom::Document::*)(), true, (mozilla::RunnableKind)0>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1203:13
    #46 0x7f1ec23532bf in mozilla::SchedulerGroup::Runnable::Run() src/xpcom/threads/SchedulerGroup.cpp:143:20
    #47 0x7f1ec2397072 in mozilla::RunnableTask::Run() src/xpcom/threads/TaskController.cpp:483:16
    #48 0x7f1ec2363ce0 in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) src/xpcom/threads/TaskController.cpp:786:26
    #49 0x7f1ec2361528 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) src/xpcom/threads/TaskController.cpp:622:15
    #50 0x7f1ec2361c3d in mozilla::TaskController::ProcessPendingMTTask(bool) src/xpcom/threads/TaskController.cpp:406:36
    #51 0x7f1ec23a10b1 in operator() src/xpcom/threads/TaskController.cpp:139:37
    #52 0x7f1ec23a10b1 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_0>::Run() src/xpcom/threads/nsThreadUtils.h:534:5
    #53 0x7f1ec237e458 in nsThread::ProcessNextEvent(bool, bool*) src/xpcom/threads/nsThread.cpp:1159:16
    #54 0x7f1ec238919c in NS_ProcessNextEvent(nsIThread*, bool) src/xpcom/threads/nsThreadUtils.cpp:548:10
    #55 0x7f1ec35458bf in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) src/ipc/glue/MessagePump.cpp:85:21
    #56 0x7f1ec344d171 in RunInternal src/ipc/chromium/src/base/message_loop.cc:335:10
    #57 0x7f1ec344d171 in RunHandler src/ipc/chromium/src/base/message_loop.cc:328:3
    #58 0x7f1ec344d171 in MessageLoop::Run() src/ipc/chromium/src/base/message_loop.cc:310:3
    #59 0x7f1ec9ced4f7 in nsBaseAppShell::Run() src/widget/nsBaseAppShell.cpp:137:27
    #60 0x7f1ecdf61c8f in XRE_RunAppShell() src/toolkit/xre/nsEmbedFunctions.cpp:911:20
    #61 0x7f1ec344d171 in RunInternal src/ipc/chromium/src/base/message_loop.cc:335:10
    #62 0x7f1ec344d171 in RunHandler src/ipc/chromium/src/base/message_loop.cc:328:3
    #63 0x7f1ec344d171 in MessageLoop::Run() src/ipc/chromium/src/base/message_loop.cc:310:3
    #64 0x7f1ecdf61668 in XRE_InitChildProcess(int, char**, XREChildData const*) src/toolkit/xre/nsEmbedFunctions.cpp:743:34
    #65 0x55e53053474d in content_process_main(mozilla::Bootstrap*, int, char**) src/browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
    #66 0x55e530534b7d in main src/browser/app/nsBrowserApp.cpp:313:18
    #67 0x7f1ee3cd60b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
    #68 0x55e530485a49 in _start (/home/user/workspace/browsers/m-c-20210604154219-fuzzing-asan-opt/firefox+0x5ba49)
Severity: -- → S3
See Also: → 1715357
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: